<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:r="http://ricchieri.com/facelets"
	xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
	<ui:composition template="../../templates/commonLayoutOther.xhtml">
		<ui:define name="title">#{msg.titleOther}</ui:define>
		<ui:define name="content">
			<f:event type="preRenderView" listener="#{viewCharterMB.init}" />
			
			<h:form id="exportReport">
				<p:messages showDetail="false" autoUpdate="true" closable="false"/>
				<h2>#{msg.searchedCharter}</h2>
			</h:form>
			
			<r:viewCharter manageBean="#{viewCharterMB}" selectedCharter="#{viewCharterMB.selectedCharter}"/>
			
			<h:form>
				<p:blockUI block="charterExpenseTable" trigger="charterExpenseTable">  
			        #{msg.loading}<br />  
			        <p:graphicImage value="/images/ajax-loader.gif"/>  
			    </p:blockUI>
			    
				<h2>#{msg.charterExpenses}</h2>
				<p:dataTable var="charterExpenses" value="#{viewCharterMB.charterExpenseLazyDataModel}"
							paginatorPosition="bottom" id="charterExpenseTable"
							paginator="true" lazy="true"
							rows="10"
							emptyMessage="#{msg.charterExpensesEmpty}"
							style="padding-top:0px;width:100%">  
		  
		  		        <p:column headerText="#{msg.charterExpenseDate}" style="width:30%">  
			            	<h:outputText value="#{viewCharterMB.formatDate(charterExpenses.date)}" />   
		        		</p:column> 
		        		
		        		<p:column headerText="#{msg.charterExpenseType}" style="width:30%">  
			            	<h:outputText value="#{viewCharterMB.obtainDescription(charterExpenses.charterExpenseType.description)}" />   
		        		</p:column>		
		        		
		        		<p:column headerText="#{msg.charterExpenseAmount}" style="width:30%">  
			            	<h:outputText value="#{charterExpenses.amount}" />   
		        		</p:column> 
		        		        
		        		<p:column headerText="#{msg.actions}" style="width:40%">
		        			<center>
		        				<h:commandLink action="#{viewCharterMB.viewCharterExpense(charterExpenses)}" ajax="false" process="@form" immediate="true">
		        					<i class="icon-zoom-in icon-2x color-zoom"></i>
		        				</h:commandLink>
		        				<r:space/><r:space/>
		        				
		        				<h:commandLink action="#{viewCharterMB.editCharterExpense(charterExpenses)}" ajax="false" process="@form" immediate="true">
		        					<i class="icon-edit icon-2x color-edit"></i>
		        				</h:commandLink>
								<r:space/><r:space/>
		        				
		        				<p:commandLink oncomplete="deleteCharterExpense.show();" action="#{viewCharterMB.showDialog(charterExpenses)}" process="@form" immediate="true">
			        				<i class="icon-remove-sign icon-2x color-delete"></i>
		        				</p:commandLink>
		        				<r:space/><r:space/>
		        			</center>
		        		</p:column>  		
				 </p:dataTable>
			 
				<div style="padding-top:10px; text-align:right">
					<r:commandLinkCustom id="searchCharter" action="#{viewCharterMB}" method="doBackToSearchCharter" icon="icon-zoom-out" message="#{msg.searchCharter}" style="font-size:14px" ajax="false"/>
		     		<r:commandLinkCustom id="export" action="#{viewCharterMB}" method="createReport" icon="icon-cloud-download" message="#{msg.download}" style="font-size:14px" ajax="false"/>
					<r:commandLinkCustom id="add" action="#{viewCharterMB}" method="addCharterExpense" icon="icon-money" message="#{msg.addNewExpense}" style="font-size:14px"/>
				</div>
				<p:confirmDialog id="confirmDialogDel" message="#{msg.deleteMessage}"  
		                header="#{msg.deleteProcessHeader}" severity="alert" widgetVar="deleteCharterExpense"> 
			    	<center> 
			        	<p:commandButton id="confirmdelete" value="#{msg.yesMessage}" oncomplete="deleteCharterExpense.hide()" action="#{viewCharterMB.delete()}" update="@form" partialSubmit="true" process="@form" />  
			        	<p:commandButton id="declinedelete" value="#{msg.noMessage}" oncomplete="deleteCharterExpense.hide()" action="#{viewCharterMB.unselect()}"/>     
			    	</center>       
			    </p:confirmDialog> 
			</h:form>

		</ui:define>
	</ui:composition>
</h:body>
</html>
